During the execution of a program it is most desirable to find performance bugs by monitoring the execution and detecting the errors as the program runs. Instrumenting programs with code to monitor their dynamic behavior is a well known technique. Most instrumentation is either incorporated manually by programmers or automatically through the use of specialized tools.
Writing instrumentation code directly into a program is an invasive procedure, and may require the programmer to make changes throughout the program and libraries, thereby polluting the source code. The manual insertion of instrumentation also may require a major effort on the part of the programmer to check complex properties since a low level programming language is often used. Thus, manual instrumentation is labor intensive and results in a code that is more difficult to read and maintain.
Specialized tools, such as tracing and logging infrastructures, capture events in a log database through noninvasive techniques. See, for example, Jinsight and Javinci from IBM Corp. for JAVA™ (Sun Microsystems) applications. After capturing events, the programmer may then query the database. While off-line evaluation of the query allows for a constant sized memory footprint as events are gathered during program execution, the overhead of building and querying a database is higher than that of manual instrumentation techniques.
Research work has also been conducted in instrumentation techniques that allow a programmer to construct queries that may be compiled in code and incorporated into the monitored program. See, for example, D. Drusinsky, “The Temporal Rover and the ATG Rover,” Lecture Notes in Computer Science, Proceedings of the 7th International SPIN Workshop on SPIN Model Checking and Software Verification, Springer-Verlag, 2000, pp. 323-329; and I. Lee et al., “Runtime Assurance Based on Formal Specifications,” In Proceedings of the International Conference on Parallel and Distributed Processing Techniques and Applications, 1999. The incorporated code checks the desired property of the program as the program runs. However, the query languages are not expressive and require the programmer to identify event generation points, where the instrumentation is to take place.